package com.tommy.jiami.utils.task;

import android.app.*;
import android.content.*;
import android.os.*;
import com.tommy.jiami.utils.*;
import java.util.*;

public abstract class Task<Param,Result> extends AsyncTask<Param,Object,Result>
{	
	Context context;
	CharSequence text;
	ProgressDialog dialog;
	
	public Task(Context context,CharSequence text){
		this.context=context;
		this.text=text;
	}
	
	@Override
	protected void onPreExecute()
	{
		dialog=new ProgressDialog(context);
		dialog.setCanceledOnTouchOutside(false);
		dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
		dialog.setMessage(text);
		dialog.show();
		super.onPreExecute();
	}
	
	@Override
	protected void onPostExecute(Result result)
	{
		dialog.cancel();
		onGetResult(result);
	}
	
	public abstract void onGetResult(Result result);
}
